﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasyStep.Data.Entities;
using NHibernate.Criterion;
using EasyStep.Business.Interfaces.Providers;

namespace EasyStep.Business.Providers
{
    public class TestConstantsProvider : DataProviderBase<TestConst>, ITestConstantsProvider 
    {
        
        public IEnumerable<TestConst> GetConstants(Guid listId)
        {
            using (var sm = CreateSessionManager(true))
            {
                return sm.Session.CreateCriteria<TestConst>()
                    .Add(Expression.Eq("ListId", listId))
                    .List<TestConst>();
            }
        }
    }

    public class TestConstantsListsProvider : DataProviderBase<TestConstList>, ITestConstantsListProvider
    {

        public IEnumerable<TestConstList> GetProjectConstList(Guid projectId)
        {

            using (var sm = CreateSessionManager(true))
            {
                return sm.Session.CreateCriteria<TestConstList>()
                    .Add(Expression.Eq("ProjectId", projectId))
                    .List<TestConstList>();
            }
        }
    }
}
